package com.cn.wanxi.service;

import com.cn.wanxi.dao.NewsDao;
import com.cn.wanxi.model.NewsModel;

import java.util.ArrayList;
import java.util.List;

public class NewsService {
    public List<Object> getNewsModels() {
        List<Object> list = new ArrayList<>();
        NewsDao newsDao = new NewsDao();
        int leng = newsDao.getContent().length;
        for (int i = 0; i < leng; i++) {
            NewsModel newsModel = new NewsModel();
            newsModel.setHref(newsDao.getHrefs()[i]);
            newsModel.setContent(newsDao.getContent()[i]);
            newsModel.setTitle(newsDao.getTitles()[i]);
            list.add(newsModel);
        }
        return list;
    }
}
